#include "playgame.h"

playgame::playgame(QWidget *parent) : QWidget(parent)
{
    this->parent=parent;
    this->resize(1149,702);
    //窗口
    this->setWindowTitle("Fishing Joy");//窗口名字
    this->setWindowIcon(QIcon(":/1/widgetfish_1.png"));//设置图标（在左上角小图标
    //背景
    QPalette palette;//调色板
    palette.setBrush(QPalette::Background,QBrush(QPixmap(":/1/photo_1.png")));//笔刷，添加背景图片
    this->setPalette(palette);

    this->setAutoFillBackground(true);

    //添加按钮
    //难度等级
    this->level1=new QPushButton(this);
    this->level1->setIcon(QIcon(":/1/level1_180_86_2.jpg"));
    this->level1->setIconSize(QSize(180,86));
    this->level1->setFlat(true);
    this->setFocusPolicy(Qt::NoFocus);

    this->level2=new QPushButton(this);
    this->level2->setIcon(QIcon(":/1/level2_180_64.jpg"));
    this->level2->setIconSize(QSize(180,86));
    this->level2->setFlat(true);
    this->setFocusPolicy(Qt::NoFocus);//可以去掉黑虚框


    this->level3=new QPushButton(this);
    this->level3->setIcon(QIcon(":/1/level3_180_69.jpg"));
    this->level3->setIconSize(QSize(180,86));
    this->level3->setFlat(true);
    this->setFocusPolicy(Qt::NoFocus);

    //退出按钮
    this->ret=new QPushButton(this);
    this->ret->setIcon(QIcon(":/1/return180_68.jpg"));
    this->ret->setIconSize(QSize(180,86));
    this->ret->setFlat(true);
    this->setFocusPolicy(Qt::NoFocus);

    //布局避免堆积在一起，垂直分布     采用坐标使其下移？？
    this->buju=new QVBoxLayout(this);
    this->buju->addWidget(level1);
    this->buju->addWidget(level2);
    this->buju->addWidget(level3);
    this->buju->addWidget(ret);

    this->connect(ret,SIGNAL(clicked()),this,SLOT(retclick()));
    this->connect(level1,SIGNAL(clicked()),this,SLOT(level1click()));
}

void playgame::retclick()
{
    this->hide();//把自己隐藏
}

void playgame::level1click()
{
    this->parent->hide();
    le1=new level1view;
    le1->show();

}

void playgame::level2click()
{

}

void playgame::level3click()
{

}

























